package psn.zjk.springboot.service;

import org.aspectj.lang.JoinPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

import javax.annotation.PostConstruct;

/**
 * @Description
 * @User zero
 * @Datetime 2021/6/6 18:44
 */
@SpringBootApplication
@EnableAspectJAutoProxy
public class AopTest {

   @Autowired
   AopService aopService;

//   @Pointcut("@within(@Aspect)")
   public void x(JoinPoint joinPoint){
      System.out.println(joinPoint.getTarget());
   }

   @PostConstruct
   public void ini(){
      aopService.exec();
   }

   public static void main(String[] args) {
      SpringApplication.run(new Class[]{psn.zjk.springboot.service.AopTest.class, AopTest2.class},new String[]{});
   }


}
